#if !defined(__CL_ENABLE_EXCEPTIONS)
#define __CL_ENABLE_EXCEPTIONS
#endif

#include "PlatformInfo.hpp"
#include "cl.hpp"
#include <iostream>

using namespace cl;

PlatformInfo::PlatformInfo(const Platform &platform) {
    try {
        vendor     = platform.getInfo<CL_PLATFORM_VENDOR>();
        name       = platform.getInfo<CL_PLATFORM_NAME>();
        version    = platform.getInfo<CL_PLATFORM_VERSION>();
        profile    = platform.getInfo<CL_PLATFORM_PROFILE>();
        extensions = platform.getInfo<CL_PLATFORM_EXTENSIONS>();
    } catch(Error &e) {
        std::cerr << "cl::PlatformInfo::PlatformInfo " <<
                     e.what() << "(" << e.err() << ")" << std::endl;
    }
}

const char *PlatformInfo::getName(void) const {
    return name.c_str();
}

const char *PlatformInfo::getVendor(void) const {
    return vendor.c_str();
}

const char *PlatformInfo::getVersion(void) const {
    return version.c_str();
}

const char *PlatformInfo::getProfile(void) const {
    return profile.c_str();
}

const char *PlatformInfo::getExtensions(void) const {
    return extensions.c_str();
}
